package com.example.administrator.weipiao;

import android.support.v4.app.Fragment;
import android.support.v4.view.ViewPager;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.view.Window;

import java.util.ArrayList;

import adapter.FragmentAdapter;
import splash.FiveFragment;
import splash.FourFragment;
import splash.OneFragment;
import splash.ThreeFragment;
import splash.TwoFragment;

public class SecondActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        //取消标题栏
        //RequestWindowFeature(Window.FEATURE_NO_TITLE);
        supportRequestWindowFeature(Window.FEATURE_NO_TITLE);
        setContentView(R.layout.activity_second);
        ViewPager mVp = (ViewPager) findViewById(R.id.vp);

        ArrayList<Fragment> fragments = new ArrayList<>();
        //创建对象加入集合
        OneFragment oneFragment = new OneFragment();
        TwoFragment twoFragment = new TwoFragment();
        ThreeFragment threeFragment = new ThreeFragment();
        FourFragment fourFragment = new FourFragment();
        FiveFragment fiveFragment = new FiveFragment();
        fragments.add(oneFragment);
        fragments.add(twoFragment);
        fragments.add(threeFragment);
        fragments.add(fourFragment);
        fragments.add(fiveFragment);

        FragmentAdapter adapter = new FragmentAdapter(getSupportFragmentManager(),fragments);
        mVp.setAdapter(adapter);
    }

    public void change(View view) {
        finish();
    }
}
